<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>注册用户界面</title>
</head>
<script>
    function validUserName(){
        var name = document.getElementById("userId").value;
        var brief = document.getElementById("selfbrief").value;

        if(name.length == 0 ){
            alert("账号不能为空");
            return false;
        }
        if(brief.length == 0){
            alert("自我介绍不能为空");
            return false;
        }
       
        var reg ="^admin$";
        if(!name.match(reg)){
            alert("用户名必须为admin");
            return false;
        }
        
        alert("自我介绍 :"+ brief);
        return true;
    }
</script>
<body>
    <div align ="center" border ="20px">
        <form action="bai" method="GET" onsubmit="return validUserName()">
            <div>
                <label for="userName" >用户名 :</label>
                <input type="text" id="userId" name ="userName" placeholder="请输入用户名" maxlength=6>
            </div>
            <div>
                <label for="passwd" >密码  :</label>
                <input type="password" name ="passwd">
            </div>
            <div>
                <input type="radio" name="sex" value="male">男
                <input type="radio" name="sex" value="female" >女
            </div>   
            <div>
                    <input type="radio" name="edu" value = "bachelor">本科
                    <input type="radio" name="edu" value = "college" >专科
            </div> 
            <p>自我介绍<br/>
                <textarea id ="selfbrief" rows ="5" cols ="20" name ="brief"></textarea>
            </p>
            <p>
                <input type ="submit" value="注册" >
                <input type ="reset" value ="重置">
            </p>
        </form>
    <button  onclick="location.href='register.html' ">本页面</button>
    </div>
</body>
</html>